<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=面向, initial-scale=1.0">
    <title>json</title>
</head>

<body>

</body>

</html>
<script>
    let person = {
        nickname: "刘晓兰",
        age: 18,
        gender: 0,
    };
    // JSON.stringify(对象名) 返回值为该对象的json格式字符串
    let text = JSON.stringify(person);
    window.console.log(person);
    window.console.log(text);
    // JSON.parse(json格式字符串) 返回值为对象
    let lady = JSON.parse(text);
    window.console.log(lady);
    // rest restfull
</script>